<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>开关2</title>

  <style>
    html, body {
      background: #e8e8e8;
    }
    /* From www.lingdaima.com */
    /* The switch - the box around the slider */
    .switch {
      /* --moon-mask: ; */
      position: relative;
      display: inline-block;
      width: 50px;
      height: 25px;
      font-size: 17px;
    }

    /* Hide default HTML checkbox */
    .switch input {
      display: none;
      /* opacity: 0;
      width: 0;
      height: 0; */
    }

    /* The slider */
    .slider {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #cbcbe1;
      transition: .4s;
      border-radius: 25px;
      cursor: pointer;
    }

    .slider:before {
      position: absolute;
      content: "";
      left: 4px;
      bottom: 2px;
      width: 21px;
      height: 21px;
      border-radius: 50%;
      background: linear-gradient(40deg, #ff0080, #ff8c00 70%);
      transition: .4s;
    }

    input:checked + .slider {
      background-color: #303136;
    }

    input:checked + .slider:before {
      transform: translateX(100%);
      background: #303136;
      box-shadow: inset -3px -2px 5px -2px #8983f7, inset -10px -5px 0 0 #a3dafb;
    }
  </style>
</head>

<body>
  <label class="switch">
    <input type="checkbox">
    <span class="slider"></span>
  </label>
</body>

</html>